<template>
	<!-- 邮寄 -->
	<view>
		<u-navbar title="退款" :autoBack="true" :placeholder="true"></u-navbar>
		<view class="from card">
			<view class="from-row">
				<text class="title">商家信息</text>
			</view>
			<view class="from-row">
				<text class="laber">商家地址</text>
				<input type="text" v-model="refound.sh_address" disabled>
			</view>
			<view class="from-row">
				<text class="laber">收件人</text>
				<input type="text" v-model="refound.sh_name" disabled>
			</view>
			<view class="from-row">
				<text class="laber">电话</text>
				<input type="text" v-model="refound.sh_mobile" disabled>
			</view>
		</view>
		<view class="from card">
			<view class="from-row">
				<text class="title">物流编号</text>
			</view>
			<view class="from-row">
				<input type="text" class="ipt" placeholder="物流编号" v-model="value">
			</view>
		</view>
		<view class="btn" @click="btnClick">
			提交
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: "",
				refound: {}
			};
		},
		onLoad(option) {
			this.refound = JSON.parse(option.refound)
		},
		methods: {
			async btnClick() {
				let logistics_no = this.value.replace(/\s+/g, "") //去除所有空格
				if (logistics_no === "") {
					this.$u.toast('请填写物流编号')
				} else {
					let {
						code,
						msg
					} = await this.$api.youji({
						id: this.refound.id,
						logistics_no
					})
					uni.$u.toast(msg)
					if (code === 1) {
						setTimeout(() => {
							uni.navigateBack({
								delta: 2
							})
						}, 1500)
					}
				}

			}
		}
	}
</script>

<style>
	page {
		box-sizing: border-box;
		padding: 0 24rpx;
	}
</style>
<style lang="scss" scoped>
	.from {
		&-row {
			width: 100%;
			box-sizing: border-box;
			padding: 15rpx 0;
			color: rgba(0, 0, 0, 0.8);
			font-size: 28rpx;
			font-weight: 400;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.laber {
				width: 180rpx;
			}

			input {
				flex: 1;
			}

			.title {
				color: rgba(0, 0, 0, 0.8);
				font-size: 32rpx;
				font-weight: 500;
			}

			.ipt {
				padding: 20rpx;
				border-radius: 12rpx;
				overflow: hidden;
				background: rgba(248, 249, 254, 1);
			}

		}
	}

	.btn {
		margin: 260rpx auto 0;
		width: 686rpx;
		height: 88rpx;
		border-radius: 600rpx;
		opacity: 1;
		text-align: center;
		line-height: 88rpx;
		color: #fff;
		background: linear-gradient(131.2deg, rgba(179, 142, 255, 1) 0%, rgba(130, 111, 255, 1) 100%);
	}
</style>
